﻿using System;
using System.ServiceModel;
using ExplorerService.Common.DataContracts.Operations;
using ExplorerService.Common.DataContracts.Operations.OperationProgress;

namespace ExplorerService.Common.ServiceContracts
{
    /// <summary>
    /// Service used by application to get queued operations and post operation progress messages
    /// </summary>
    [ServiceContract]
    public interface IApplicationOperationsService
    {
        /// <summary>
        /// Returns the next available operation that needs to be performed by this application
        /// </summary>
        /// <param name="applicationSessionId">The application session ID</param>
        /// <returns>The next queued operation or Exception if the request is invalid</returns>
        [OperationContract]
        Operation GetNextOperation(Guid applicationSessionId);

        /// <summary>
        /// Posts the operation progress (sent to the client)
        /// </summary>
        /// <param name="applicationSessionId">The session ID for the application running the operation</param>
        /// <param name="operationProgress">The operation progress object</param>
        [OperationContract]
        bool PostOperationProgress(Guid applicationSessionId, OperationProgress operationProgress);


        /// <summary>
        /// Gets the cancel flag for the operation
        /// </summary>
        [OperationContract]
        bool CancelPending(Guid applicationSessionId, Guid operationId);
    }

}
